import {
  LoginForm,
  Response,
  ResponseJSONObject,
  Responsestring,
  ResponseUserLoginDto
} from '@/types/apiType';

import request from '../utils/request';
import { RequestConfig } from '../utils/request/type';

/**
 * @description
 * @tags 用户登录
 * @summary 绑定openid
 * @request post:/api/user/bindOpenid
 */
export const apiUserBindOpenidByPost = (params: { jsCode: string }, config?: RequestConfig) =>
  request.post<Response>(`/api/user/bindOpenid`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 单点登录
 * @request post:/api/user/login
 */
export const apiUserLoginByPost = (params: LoginForm, config?: RequestConfig) =>
  request.post<ResponseUserLoginDto>(`/api/user/login`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口
 * @request get:/api/user/testApi
 */
export const apiUserTestApiByGet = (
  params: {
    activeId?: string;
    adjScore?: string;
    adjType?: string;
    amtMax?: string;
    amtMin?: string;
    certNo?: string;
    channelNo?: string;
    channelUserId?: string;
    custName?: string;
    endTime?: string;
    mobileNo?: string;
    operationName?: string;
    payTypeCode?: string;
    recommenderId?: string;
    startTime?: string;
    type: number;
  },
  config?: RequestConfig
) =>
  request.get<ResponseJSONObject>(`/api/user/testApi`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口-优惠券发放
 * @request get:/api/user/testApi/10
 */
export const apiUserTestApi10ByGet = (
  params: {
    channelCustNo?: string;
    couponId?: string;
    cretNo?: string;
    getCnl?: string;
    mobile?: string;
  },
  config?: RequestConfig
) =>
  request
    .get<ResponseJSONObject>(`/api/user/testApi/10`, params, config)
    .then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口-优惠券券码状态更新
 * @request get:/api/user/testApi/11
 */
export const apiUserTestApi11ByGet = (
  params: { codeState?: string; couponCode?: string; useCnl?: string },
  config?: RequestConfig
) =>
  request
    .get<ResponseJSONObject>(`/api/user/testApi/11`, params, config)
    .then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口-个人优惠券券码列表查询
 * @request get:/api/user/testApi/12
 */
export const apiUserTestApi12ByGet = (
  params: {
    channelCustNo?: string;
    current?: string;
    size?: string;
    state?: string;
    typeId?: string;
  },
  config?: RequestConfig
) =>
  request
    .get<ResponseJSONObject>(`/api/user/testApi/12`, params, config)
    .then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口-优惠券库存查询
 * @request get:/api/user/testApi/18
 */
export const apiUserTestApi18ByGet = (params: { couponId?: string }, config?: RequestConfig) =>
  request
    .get<ResponseJSONObject>(`/api/user/testApi/18`, params, config)
    .then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口-查询最长达标天数
 * @request get:/api/user/testApi/8
 */
export const apiUserTestApi8ByGet = (
  params: {
    accType?: string;
    addAmt?: string;
    channelUserId?: string;
    endTime?: string;
    hostCustNo?: string;
    productTypeArray: string[];
    startTime?: string;
  },
  config?: RequestConfig
) =>
  request.get<ResponseJSONObject>(`/api/user/testApi/8`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 测试接口-优惠券列表查询
 * @request get:/api/user/testApi/9
 */
export const apiUserTestApi9ByGet = (
  params: { current?: string; size?: string },
  config?: RequestConfig
) =>
  request.get<ResponseJSONObject>(`/api/user/testApi/9`, params, config).then((res) => res?.result);

/**
 * @description
 * @tags 用户登录
 * @summary 生成测试链接
 * @request get:/api/user/testApi/mockLogin
 */
export const apiUserTestApiMockLoginByGet = (
  params: { ecifNoId: string; mobileNo: string; userId: string },
  config?: RequestConfig
) =>
  request
    .get<Responsestring>(`/api/user/testApi/mockLogin`, params, config)
    .then((res) => res?.result);
